The flip
function is used to flip the order of coordinates of a GeoJSON geometry object.
Parameter | Type | Description |
---|---|---|
geojson |
GeoJSON | The input GeoJSON geometry object to flip its coordinates. |
The function returns a new GeoJSON geometry object with the flipped coordinates.
var point = {
"type": "Point",
"coordinates": [10, 20]
};
var flippedPoint = turf.flip(point);
console.log(flippedPoint);
// Output: { "type": "Point", "coordinates": [20, 10] }
The flip
function only flips the order of coordinates of the given GeoJSON geometry object. To flip the coordinates of a Feature or FeatureCollection, the map
function can be used to apply the flip
function to each geometry object.